﻿
Public Class remotelogger
    Inherits loghandler

    Public Shadows Const backupConfignaming As String = "remotelogger"
    Protected server As String = Nothing
    Protected port As Int32 = npos
    Protected commode As String = Nothing

    Protected Overloads Overrides Sub initial()
        server = configParameter(Of String)(configNaming.remotelogger.server)
        port = configParameter(Of Int32)(configNaming.remotelogger.port, configNaming.defaultValue.remotelogger.port)
        commode = configParameter(Of String)(configNaming.remotelogger.commode)
    End Sub

    Protected Overloads Overrides Sub oneline(ByRef log As String, ByRef casename As String)
        Dim errtype As errorHandle.errorType
        Dim errtypeChar As Char
        Dim time As String = Nothing
        Dim msg As String = Nothing
        If Not breakupErrMsg(log, errtype, errtypeChar, time, msg) Then
            raiseError("cannot breakup log " + log, errorHandle.errorType.warning)
        Else
            If Not rlogclient.comm(commode, name, time + errorHandle.seperator + msg _
                                    , errtype, errtypeChar, server, port) Then
                raiseError("cannot write log to rlogserve, server " + server + ", port " + Convert.ToString(port) _
                           + ", commode " + commode, errorHandle.errorType.system)
            End If
        End If
    End Sub

    Public Sub New()
        caseConfigNaming = configNaming.remotelogger.remotelogger
        multimatch = configNaming.defaultValue.remotelogger.multimatch
        MyBase.backupConfignaming = backupConfignaming
    End Sub
End Class
